ExportService.performExport Method

Performs an export of a View.
 

Parameters

exportRequest

Type: ExportRequest
The request that provides the export information.

Return Value


Type: jQuery.Promise
Value: String
A promise object that is resolved when the call is complete. If successful, a String is returned with the ID of the export. 

Examples

This sample exports the current view to PDF. This code would be executed on a button click on a dashboard.



/*
// This sample requires the Standard Export Providers extension to be installed:
// http://www.dundas.com/support/learning/documentation/install-configure/installing-the-standard-export-providers-extension
*/

// Get the export service.
var exportService = this.getService('ExportService');

// Get the view service.
var viewService = this.getService('ViewService');

// Get the web app service.
var webAppService = this.getService('WebAppService');

// Get the dashboard or view id.
var dashboardId = this.parentView.id;

var contextual = dundas.Utility.getContextualPageUrl(
  dundas.Pages.DASHBOARD, 
  { 
    id: dashboardId,
    queryString:  [ new dundas.KeyValuePair(dundas.constants.VIEW_OPTIONS_QUERY_STRING_KEY, dundas.ViewOptions.VIEW_ONLY) ]
  }
);

var shortLinkService = window.dundas.context.getService("ShortLinkService");

// Get the shortlink.
var shortLinkPromise = shortLinkService.getShortLink(contextual);

shortLinkPromise.done(
  function(shortLink)
  {

    var fullLinkAddress = dundas.Utility.getFullContextualPageUrl(dundas.Pages.LINK, {
        "queryString": [new dundas.KeyValuePair(dundas.constants.SHORT_LINK_QUERY_STRING_KEY, shortLink)]
    });
    

    
    // Create the export request.
    var exportRequest = 
        new dundas.export.ExportRequest(
          {
            isLegacyExport: true,
            // PDF provider id.
            providerId: '5752EB39-40B5-4D79-B96B-9F9297C67193',
            viewId: dashboardId
          });

    if(orientationList.value == 'Landscape')
    {
    	exportRequest.parameterValues.push(new dundas.data.SingleStringValue(
          {
            parameterId: '2D51F548-F554-4E4A-9948-FBB3E4694FBE',
            value: 'landscape'
          }
        	)
        );	 	 
    }
    else
    {
      	  exportRequest.parameterValues.push(new dundas.data.SingleStringValue(
          {
            parameterId: '2D51F548-F554-4E4A-9948-FBB3E4694FBE',
            value: 'portrait'
          }
        	)
        );
    }
    
    // Set the paper size. - optional
    exportRequest.parameterValues.push(new dundas.data.SingleStringValue(
      {
        parameterId: 'BBE12D5C-9713-4B2C-9BF9-61B40F9B1794',
        value: paperSizeList.value
      })
    );
    
    exportRequest.viewUrl = fullLinkAddress;
    
    // Get the perform export promise.
    var exportPromise = 
        exportService.performExport(exportRequest);

    // Setup a loading dialog.
    viewService.showLoadingRestCall(exportPromise);

    exportPromise.done(
      function(exportId)
        {
            // Get the Url for the export file.
            var exportFileUrl =
                webAppService.getExportResultUrl(exportId);

            // Force the browser to download the file.  
            window.location.replace(exportFileUrl);
        }
    );

  }
);           


This sample exports the current view to PowerPoint. This code would be executed on a button click on a dashboard.



/*
// This sample requires the Standard Export Providers extension to be installed:
// http://www.dundas.com/support/learning/documentation/install-configure/installing-the-standard-export-providers-extension
*/

// Get the export service.
var exportService = this.getService('ExportService');

// Get the view service.
var viewService = this.getService('ViewService');

var webAppService = this.getService('WebAppService');

// Get the dashboard or view id.
var dashboardId = this.parentView.id;

var contextual = dundas.Utility.getContextualPageUrl(
  dundas.Pages.DASHBOARD, 
  { 
    id: dashboardId,
    queryString:  [ new dundas.KeyValuePair(dundas.constants.VIEW_OPTIONS_QUERY_STRING_KEY, dundas.ViewOptions.VIEW_ONLY) ]
  }
);

var shortLinkService = window.dundas.context.getService("ShortLinkService");

// Get the shortlink.
var shortLinkPromise = shortLinkService.getShortLink(contextual);

shortLinkPromise.done(
  function(shortLink)
  {

    var fullLinkAddress = dundas.Utility.getFullContextualPageUrl(dundas.Pages.LINK, {
        "queryString": [new dundas.KeyValuePair(dundas.constants.SHORT_LINK_QUERY_STRING_KEY, shortLink)]
    });
    

    
    // Create the export request.
    var exportRequest = 
        new dundas.export.ExportRequest(
          {
            isLegacyExport: true,
            // PowerPoint provider id.
            providerId: 'b58d4c94-9f4f-4d38-800b-2b5d4d348625',
            viewId: dashboardId
          });

    exportRequest.viewUrl = fullLinkAddress;
    
    // Get the perform export promise.
    var exportPromise = 
        exportService.performExport(exportRequest);

    // Setup a loading dialog.
    viewService.showLoadingRestCall(exportPromise);

    exportPromise.done(
      function(exportId)
        {
            // Get the Url for the export file.
            var exportFileUrl =
                webAppService.getExportResultUrl(exportId);

            // Force the browser to download the file.  
            window.location.replace(exportFileUrl);
        }
    );

  }
);
                      


This sample exports the current view to Excel. This code would be executed on a button click on a dashboard.



/*
// This sample requires the Standard Export Providers extension to be installed:
// http://www.dundas.com/support/learning/documentation/install-configure/installing-the-standard-export-providers-extension
*/

// Get the export service.
var exportService = this.getService('ExportService');

// Get the view service.
var viewService = this.getService('ViewService');

// Get the web app service.
var webAppService = this.getService('WebAppService');

// Create the export request.
var exportRequest = 
    new dundas.export.ExportRequest(
      {
        isLegacyExport: false,
        // Export Excel
        providerId: '679E6337-48AA-4AA3-AD3D-DB30CE943DC9',
        viewId: this.parentView.id
      });

// Get the perform export promise.
var exportPromise = 
    exportService.performExport(exportRequest);

// Setup a loading dialog.
viewService.showLoadingRestCall(exportPromise);

exportPromise.done(
  function(exportId)
	{
      	// Get the Url for the export file.
      	var exportFileUrl =
    		webAppService.getExportResultUrl(exportId);
      
      	// Force the browser to download the file.  
      	window.location.replace(exportFileUrl);
  	}
);      


This sample exports the current view to Image. This code would be executed on a button click on a dashboard.



// Get the export service.
var exportService = this.getService('ExportService');

// Get the view service.
var viewService = this.getService('ViewService');

// Get the web app service.
var webAppService = this.getService('WebAppService');

// Create the export request.
var exportRequest = 
    new dundas.export.ExportRequest(
      {
        isLegacyExport: false,
        // Export Image
        providerId: '9A15B21E-FA9E-4ECE-8B31-9E12F1C6134A',
        viewId: this.parentView.id
      });

// Get the perform export promise.
var exportPromise = 
    exportService.performExport(exportRequest);

// Setup a loading dialog.
viewService.showLoadingRestCall(exportPromise);

exportPromise.done(
  function(exportId)
	{
      	// Get the Url for the export file.
      	var exportFileUrl =
    		webAppService.getExportResultUrl(exportId);
      
      	// Force the browser to download the file.  
      	window.location.replace(exportFileUrl);
  	}
);

    


This sample exports the current view to Image. This code would be executed on a button click on a dashboard.



 // Get the export service.
var exportService = this.getService('ExportService');

// Get the view service.
var viewService = this.getService('ViewService');

// Get the web app service.
var webAppService = this.getService('WebAppService');

// Create the export request.
var exportRequest = 
    new dundas.export.ExportRequest(
      {
        isLegacyExport: false,
        // Export Image
        providerId: '9A15B21E-FA9E-4ECE-8B31-9E12F1C6134A',
        viewId: this.parentView.id
      });

// Get the perform export promise.
var exportPromise = 
    exportService.performExport(exportRequest);

// Setup a loading dialog.
viewService.showLoadingRestCall(exportPromise);

exportPromise.done(
  function(exportId)
	{
      	// Get the Url for the export file.
      	var exportFileUrl =
    		webAppService.getExportResultUrl(exportId);
      
      	// Force the browser to download the file.  
      	window.location.replace(exportFileUrl);
  	}
);